/*LICENSE_BEGIN
 * ******************************************************************
 * Copyright 2006 by the Dainamite Robocup-Team at the
 * DAI-Labor, TU-Berlin (www.dai-labor.de)
 * 
 * Members of Dainamite are:
 * Holger Endert
 * Robert Wetzker
 * Thomas Karbe
 * Axel Heßler
 * Philippe Bütter
 * Felix Brossmann
 * 
 * Licensed under the GNU GPL (General Public License) Free Software 
 * License, Version 2. You may use this file only in compliance with 
 * the License. You may obtain a copy of the License at:
 * 
 * http://www.fsf.org/licensing/licenses/gpl.txt
 * ******************************************************************
LICENSE_END*/
package robocup.component.actionfactories;

import robocup.component.ControllerNumbers;
import robocup.component.Synchro;
import robocup.component.actions.ChangeViewModeAction;

/**
 * Factory for creating the view mode action. This implementation refers to
 * the view-mode pattern, which is used to receive a visual info in each
 * cycle.
 */
public class ViewModeActionFactory {

	/**
	 * This Method sets the view-quality and angle to a value that will cause
	 * the player to receive a visual info each cycle.
   * 
	 * @param synchro the synchro 
	 * @return - the ChangeViewModeAction
	 */
	public static ChangeViewModeAction getAction(Synchro synchro) {

		int offset = synchro.getVIArrivalQuarter();

		if (offset == 0)
			return new ChangeViewModeAction(
					ControllerNumbers.VIEW_QUALITY.HIGH,
					ControllerNumbers.VIEW_ANGLE.NORMAL);

		return new ChangeViewModeAction(ControllerNumbers.VIEW_QUALITY.HIGH,
				ControllerNumbers.VIEW_ANGLE.NARROW);
	}
}
